#!/usr/bin/env python3
# -*- coding: utf-8 -*-

'使用@contextmanager实现aop'

from contextlib import contextmanager


@contextmanager
def log(info):
    print("<%s>" % info)
    yield
    print('<执行完毕>')


with log('开始执行') as l:
    print(l) # None
    print('Hello!')
    print('Bey!')
